Xbasic

ZBLANK Function

Syntax

Formatted_String as C = ZBLANK( Number as N [, Length as N [, Decimal_Places as N ]] )

Arguments

numberNumeric

The number to format.

LengthNumeric

Default = 10. The number of characters in the Formatted_String.

Decimal_PlacesNumeric

Default = 0. The number of characters after the decimal point in the Formatted_String. If you do not specify decimal places, STR() rounds the Number to the nearest whole number.

Returns

Formatted_StringCharacter

Returns the formatted string.

Description

Converts a number to a blank character string if the number is zero.

Discussion

ZBLANK() converts a Number to a formatted right justified character string, returning a blank (empty) string if the number is zero.

Example

dim DISCOUNT as n

?zblank(DISCOUNT)
= "          "

dim len as n
len = 3
?zblank(DISCOUNT,len)
= "   "

len = 0
?zblank(DISCOUNT,len)
= ""

dim dec as n
len = 10
dec = 3
? zblank(14.3, len, dec)
= "    14.300"

See Also